package com.yiding.sys.controller;

import com.yiding.sys.common.enums.ResultCodeEnum;
import com.yiding.sys.common.model.Result;
import com.yiding.sys.pojo.SysUser;
import com.yiding.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author War horse imwarhorse@aliyun.com
 * Date: 2020/8/7
 * Description: No Description
 */

@RestController
@RequestMapping("/user")
public class SysUserController {

	@Autowired
	private SysUserService sysUserService;

	@PostMapping
	Result createUser(@Validated @RequestBody SysUser user) {
		if (!sysUserService.addUser(user)) return new Result().geneFailed(ResultCodeEnum.FAILED);

		return new Result().geneSuccess(ResultCodeEnum.SUCCESS);
	}

}
